package com.safewind.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.safewind.dao.SendRelateDao;
import com.safewind.model.SendRelate;
import com.safewind.service.ISendRelateService;
import com.safewind.util.StringUtil;

@Service("sendRelateService")
public class SendRelateServiceImpl implements ISendRelateService {

	@Resource
	private SendRelateDao sendRelateDao;

	@Override
	public void addSendRelate(SendRelate sr) {
		sendRelateDao.insertSelective(sr);
	}

	@Override
	public void addSendRelate(String pkId, String[] ids) {
		for (String id : ids) {
			SendRelate sr = new SendRelate();
			sr.setPkId(StringUtil.getUUID());
			sr.setSendId(pkId);
			sr.setAddressId(id);
			sendRelateDao.insertSelective(sr);
		}
	}

	@Override
	public List<SendRelate> getSendRelateBySendId(String sendId) {
		return sendRelateDao.getSendRelateBySendId(sendId);
	}

}
